/*
 * api管理
 */
import request from '../utils/request'
import requset from '../utils/request'
export default {
  login(params) {
    //登录
    return requset({
      url: '/users/login',
      data: params,
      method: 'post',
    })
  },
  noticeCount() {
    //获取消息数量
    return requset({
      url: '/leave/count',
      data: {},
      method: 'get',
    })
  },
  getMenuList(params) {
    //获取菜单列表
    return requset({
      url: '/menu/list',
      data: params,
      method: 'get',
    })
  },
  getUserList(params) {
    //获取用户列表
    return requset({
      url: '/users/list',
      data: params,
      method: 'get',
    })
  },
  userDel(params) {
    //用户列表-删除用户
    return requset({
      url: '/users/delete',
      data: params,
      method: 'post',
    })
  },
  getRoleAllList() {
    //用户列表新增编辑-获取所有角色
    return requset({
      url: '/roles/allList',
      data: {},
      method: 'get',
    })
  },
  getDeptAllList() {
    //用户列表新增编辑-获取所有部门
    return requset({
      url: '/dept/allList',
      data: {},
      method: 'get',
    })
  },
  userSubmit(params) {
    //用户编辑新增-提交
    return requset({
      url: '/users/operate',
      data: params,
      method: 'post',
    })
  },
  menuSubmit(params) {
    //菜单编辑-新增-删除
    return requset({
      url: '/menu/operate',
      data: params,
      method: 'post',
    })
  },
  getRoleList(params) {
    //获取角色列表-分页
    return requset({
      url: '/roles/list',
      data: params,
      method: 'get',
    })
  },
  roleSubmit(params) {
    //角色列表-编辑-新增-删除
    return requset({
      url: '/roles/operate',
      data: params,
      method: 'post',
    })
  },
  updatePermission(params) {
    //角色列表-权限保存
    return requset({
      url: '/roles/update/permission',
      data: params,
      method: 'post',
    })
  },
  getDeptList(params) {//获取部门列表
    return request({
      url: '/dept/list',
      data: params,
      menthod: 'get',
    })
  },
  deptSubmit(params){
    //部门列表-编辑-新增-删除
    return requset({
      url: '/dept/operate',
      data: params,
      method: 'post',
    })
  },
  getUserAllList(){
    //获取全部的用户
    return request({
      url: '/users/all/list',
      data: {},
      menthod: 'get',
    })
  },
  getPermissionList(){
    //获取对应角色的权限
    return request({
      url: '/users/getPermissionList',
      data: {},
      menthod: 'get',
    })
  },
  getApplyList(params){
    //申请列表
    return request({
      url: '/leave/list',
      data: params,
      menthod: 'get',
    })
  },
  leaveSubmit(params){
    //休假申请-新增-删除
    return requset({
      url: '/leave/operate',
      data: params,
      method: 'post',
    })
  },
  leaveApprove(params){
    //休假申请-审核 通过or不通过
    return requset({
      url: '/leave/approve',
      data: params,
      method: 'post',
    })
  },
}
